/*
 * RTSAI - Real-Time Strategy engine for AI research
 * Copyright(C) 2006 DIMAp-UFRN, licensed under LGPL
 *
 * Common definitions and macros
 */

#include <list>
#include <map>
#include <vector>
#include <string>
#include "Vec3.h"
#include "Obstacle.h"

using std::string;

/* Common classes declaration, for avoiding header recursions */
class Game;
class GameEvent;
class GameEventData;
class GameObject;
class Unit;
class UnitState;
class Player;
class Action;
class Message;
class MessageReceiver;

/* STL useful typedefs */
typedef std :: list < UnitState* > StateList;
typedef std :: list < GameEvent* > EventList;
typedef std :: map < std::string, GameEvent* > EventMap;
typedef std :: vector < Message* > MailBox;
typedef std :: vector < GameObject* > ObjectList;

/* Another typedefs */
typedef OpenSteer :: Vec3 Vector3D;


/*! Macro for visiting each element of a STL container, in a for loop.
 *  Example of usage:
 *    foreach (i, listeners)
 *      (*i)->notify();
 */
#define foreach( i, c )\
  typedef __typeof__( c ) c##_CONTAINERTYPE;\
  for( c##_CONTAINERTYPE::iterator i = c.begin(); i != c.end(); ++i )


#define foreach_const( i, c )\
  typedef __typeof__( c ) c##_CONTAINERTYPE;\
  for( c##_CONTAINERTYPE::const_iterator i = c.begin(); i != c.end(); ++i )


/*! Macro for calling one method of all elements of a STL container, in a for loop.
 *  Example of usage:
 *    forall (listeners, notify());
 */
#define forall( c, m )\
  typedef __typeof__( c ) c##_CONTAINERTYPE;\
  for( c##_CONTAINERTYPE::iterator i = c.begin(); i != c.end(); ++i )\
    (*i)->m;
